project('libldevice', 'c', version: '0.2.2', license: 'LGPL V3')

# Use dependency function to check for libraries
libcrypto_dep = dependency('openssl', modules: 'crypto', required: true)
libcurl_dep = dependency('libcurl', required: true)
libudev_dep = dependency('libudev', required: true)

src_dir = 'src'
inc_dir = include_directories(src_dir)

# Specify shared_library
libldevice = shared_library(
    'ldevice',
    sources: ['src/ldevice.c'],
    include_directories: [inc_dir],
    dependencies: [libcrypto_dep, libcurl_dep, libudev_dep],
    version: '0',
    install: true
)

# Specify executable program
executable(
    'ldevice',
    sources: ['src/main.c'],
    include_directories: [inc_dir],
    link_with: libldevice,
    install: true
)

# Add installation instruction for header file
install_headers('src/ldevice.h')
